<template>
    <div>
        <el-row :gutter="20">
            <el-col :span="20" >
                <div style="margin-left:20px;font-weight: bolder;color:#666">发布消息</div>
            </el-col>

            <el-col :span="4">
                <el-button @click="go">返回列表</el-button>
            </el-col>
        </el-row>

        <el-form  ref="form" :model="form" label-position="labelPosition" label-width="100px">
            <el-form-item label="消息标题" >
                {{form.title}}
            </el-form-item>
        </el-form>
        <el-form  label-position="labelPosition" label-width="100px">
            <el-form-item label="消息内容" >
                <!--<script id="editor" type="text/plain"></script>-->
                <div v-html="form.content" style="max-width:80%">
                    {{form.content}}
                </div>
            </el-form-item>
        </el-form>
    </div>
</template>
<script>
    import Bus from '@/config/bus.js'
    import _http from '@/components/common/http.vue'
    import _param from '@/components/common/param.vue'
//    import '@/assets/ueditor/ueditor.config.js'
//    import '@/assets/ueditor/ueditor.all.min.js'
//    import '@/assets/ueditor/ueditor.parse.min.js'
//    import '@/assets/ueditor/lang/zh-cn/zh-cn.js'
    export default {
        data() {
            return {
                id:'',
                apiPort:{
///                    发布内容接口
                    fabuList:"information/add",
//                    回显接口
                    getBack:"information/findById",
//                    编辑上传接口
                    editUp:'information/edit'
                },
                form:{
                    title:'',
                    content:'',
                    userid:''
                },
                activeName: 'second',
                labelPosition: 'right',
                dialogImageUrl: '',
                dialogVisible: false,
                value1: '',
            };
        },
        mounted(){
            this.id = this.$route.query.info
            this.userid=localStorage.getItem('userId')
            this.form.userid = localStorage.getItem('userId')
            var that = this
//            this.editor = UE.getEditor('editor');
            if(this.id!=1){
                console.log(this.id)
                this.getBack(this.id)
            }
        },
//        destroyed() {
//            this.editor.destroy();
//        },
        methods: {
            //            获取回显内容
            getBack(id){
                var that = this
                var params = that.querystring.stringify({'id':id,'userid':this.form.userid})
                _http.axiosRequest(that,that.apiPort.getBack,params,(res)=>{
                    that.form.title = res.data.data.title
//                that.editor.setContent(res.data.data.content)
//                str.substr(0, str.length);
//                console.log( res.data.data.content.length)
                that.form.content = res.data.data.content
                console.log( typeof that.form.content)
                console.log(res)
            })
            },
            go(){
                this.id=''
                this.$router.go(-1)
            },


        }
    };
</script>